<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.group.weekmgr.CodeBean"%>
<jsp:useBean id="codeMgr" class="com.group.weekmgr.CodeMgr"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function addCode(){
	window.open("mycode_add.jsp?week_code=0");
}

function addLastWeekData(){
	document.frm.submit();
}
</script>
</head>
<body>
<h1>전주 수행 실적</h1>
	<table>
		<tr align="left">
			<td>년도 </td>
			<td>
				<select>
					<option>2012</option>
					<option>2011</option>
					<option>2010</option>
					<option>2009</option>
				</select>
			</td>
			<td>주차선택 : </td>
			<td>
				<select>
					<option>10월 4주차(1022~1028)</option>
					<option>10월 3주차(1015~1021)</option>
					<option>10월 2주차(1008~1014)</option>
					<option>10월 1주차(1001~1007)</option>
				</select>
			</td>
			<td>
				<input type="button"  value="My 업무코드추가" onclick="addCode()"> 
			</td>
		</tr>
	</table>
	
	<table align="right">
		<tr>
			<td>
				<input type="button"  value="추가" onclick="addLastWeekData()">
			</td>
			<td>
				<input type="button"  value="삭제">
			</td>
		</tr>
	</table><br>
	<form action="addmyweek_proc.jsp" name="frm" method="post">
		<table border="1"  width="100%">
			<tr>
				<th rowspan="2">No</th>
				<th rowspan="2">코드</th>
				<th rowspan="2">활동 내역</th>
				<th rowspan="2">주요 추진 사항</th>
				<th colspan="7">수행 기간</th>
				<th rowspan="2">완료 일정</th>
				<th rowspan="2">실행(%)</th>
				<th rowspan="2">목표(%)</th>
			</tr>
			<tr>
				<th>월</th>
				<th>화</th>
				<th>수</th>
				<th>목</th>
				<th>금</th>
				<th>토</th>
				<th>일</th>
			</tr>
			<%
			if(request.getParameter("no") == null){
			%>
			<tr align="center">
				<td colspan="14">My 업무코드를 추가해주세요.</td>
			</tr>
			<%	
			}else{
				String nop = request.getParameter("no");
				String[] no = nop.split(",");
				
				ArrayList<CodeBean> list = codeMgr.addPerformMyCode(no); 
				for(int i=0; i<list.size(); i++){
					CodeBean bean = list.get(i);
			%>
			<tr align="center">
				<td><input type="text"  size="3" name="code_no" value="<%=bean.getCodeno() %>"></td>
				<td><input type="text"  size="10" name="work_code" value="<%=bean.getCode() %>"></td>
				<td><input type="text"  name="sale_memo" value="<%=bean.getCustomerName() %>"></td>
				<td><input type="text" name="activity_spec"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>1"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>2"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>3"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>4"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>5"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>6"></td>
				<td><input type="checkbox" name="check_date" value="<%=bean.getCodeno() %>7"></td>
				<td><input type="text" size="10" name="target_date"></td>
				<td><input type="text" size="10" name="target_ratio"></td>
				<td><input type="text" size="10" name="act_ratio"></td>
			</tr>
			<%
				}
			}
			%>
		</table>
		<input type="hidden" name="week_flag" value="0">
	</form>
</body>
</html>